home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / SWAG9605.DDD / 0062_Yet another Mouse Unit.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-05-31  |  994 b   |  76 lines

  1. {
  2. Here it comes (from Polish Computer Magazine ,,Bajtek'', just litlle enhanced
  3. by me): }
  4.  
  5. unit Mouse;
  6.  
  7. interface
  8.  
  9. uses Dos;
  10.  
  11. function InitMouseOk : boolean;
  12. function GetButton : byte;
  13. function GetX : byte;
  14. function GetY : byte;
  15. procedure GetMousePos(var x,y : integer);
  16. procedure MouseShow;
  17. procedure MouseHide;
  18.  
  19. implementation
  20.  
  21. var r : registers;
  22.  
  23. function InitMouseOk;
  24. begin
  25.   r.ax:=0;
  26.   intr($33,r);
  27.   InitMouseOk:=boolean(r.al)
  28. end;
  29.  
  30. function GetButton;
  31. begin
  32.   r.ax:=5;
  33.   intr($33,r);
  34.   GetButton:=r.al
  35. end;
  36.  
  37. function GetX;
  38. var x : byte;
  39. begin
  40.   r.ax:=3;
  41.   intr($33,r);
  42.   x:=r.cx shr 3;
  43.   GetX:=x
  44. end;
  45.  
  46. function GetY;
  47. var y : byte;
  48. begin
  49.   r.ax:=3;
  50.   intr($33,r);
  51.   y:=r.dx shr 3;
  52.   GetY:=y
  53. end;
  54.  
  55. procedure GetMousePos;
  56. begin
  57.   r.ax:=3;
  58.   intr($33,r);
  59.   x:=r.cx shr 3;
  60.   y:=r.dx shr 3
  61. end;
  62.  
  63. procedure MouseShow;
  64. begin
  65.   r.ax:=1;
  66.   intr($33,r)
  67. end;
  68.  
  69. procedure MouseHide;
  70. begin
  71.   r.ax:=2;
  72.   intr($33,r)
  73. end;
  74.  
  75. end.
  76.